/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaLogin.java
 *
 * Created on 28/01/2012, 03:16:27 AM
 */
package vista;

import controlador.ControladorGeneral;
import controlador.ControladorVentana;

/**
 *
 * @author Jesús Vásquez
 */
public class VentanaLogin extends javax.swing.JFrame {

    ControladorGeneral controlador;
    ControladorVentana controladorVentana;
    /** Creates new form VentanaLogin */
    public VentanaLogin() {
        initComponents();
        controlador = new ControladorGeneral();
        controladorVentana = new ControladorVentana();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabel2 = new javax.swing.JLabel();
        entrar = new javax.swing.JButton();
        salir = new javax.swing.JButton();
        login = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        pass = new javax.swing.JPasswordField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 24));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Consultorio - Login");
        jLabel2.setBounds(0, 30, 600, 50);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        entrar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        entrar.setText("Entrar");
        entrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                entrarActionPerformed(evt);
            }
        });
        entrar.setBounds(180, 240, 250, 50);
        jLayeredPane1.add(entrar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        salir.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        salir.setText("Salir");
        salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salirActionPerformed(evt);
            }
        });
        salir.setBounds(180, 300, 250, 50);
        jLayeredPane1.add(salir, javax.swing.JLayeredPane.DEFAULT_LAYER);

        login.setFont(new java.awt.Font("Tahoma", 0, 12));
        login.setBounds(230, 130, 200, 30);
        jLayeredPane1.add(login, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel1.setText("Clave");
        jLabel1.setBounds(180, 180, 50, 30);
        jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel3.setText("Login");
        jLabel3.setBounds(180, 130, 50, 30);
        jLayeredPane1.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
        pass.setBounds(230, 180, 200, 30);
        jLayeredPane1.add(pass, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void entrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_entrarActionPerformed
        controlador.leerArchivoPersona(this, login, pass);
    }//GEN-LAST:event_entrarActionPerformed

    private void salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salirActionPerformed
        controladorVentana.cerrarAplicacion(this);
    }//GEN-LAST:event_salirActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton entrar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JTextField login;
    private javax.swing.JPasswordField pass;
    private javax.swing.JButton salir;
    // End of variables declaration//GEN-END:variables
}
